﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace windowTest
{
	public partial class Form1 : Form
	{
		int shift = 0;
		public Form1()
		{
			InitializeComponent();
		}

		public void getAtom(int ceiling,int floor)
		{
			for(int i = floor; i < ceiling + 1; i++)
			{
				bool isAtom = true;
				for(double x = 2; x < Math.Sqrt(i)+1; x++)
				{
					if (i % x == 0)
					{
						isAtom = false;
						break;
					}
				}
				if (isAtom)
				{
					if (shift == 9)
					{
						shift = 0;
						string str = i.ToString()+"\n";
						richTextBoxOfResult.AppendText(str);
					}
					else
					{
						richTextBoxOfResult.AppendText(i + "   ");
						shift++;
					}
					
				}
			}
		}

		private void buttonToGetAtomNumber_Click(object sender, EventArgs e)
		{
			int ceiling = int.Parse(textBoxOfCeiling.Text);
			int floor = int.Parse(textBoxOfFloor.Text);
			getAtom(ceiling, floor);
		}
	}
}
